package Sudoku;

import java.awt.*;
import java.awt.event.*;
import java.applet.*;

public class RatonApplet6 extends Applet implements MouseListener, MouseMotionListener {
    int uX=0, uY=0;

    public RatonApplet6() {
    }

    public void init() {
        try {
        jbInit();
        }
        catch (Exception e) {
        e.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        int ancho = Integer.parseInt(this.getParameter("WIDTH"));
        int alto = Integer.parseInt(this.getParameter("HEIGHT"));
        this.setSize(new Dimension(ancho, alto));
        setBackground(Color.white);
        this.addMouseListener(this);
        this.addMouseMotionListener(this);
    }
 //interface MouseListener
    public void mousePressed(MouseEvent ev) {
        uX=ev.getX();
        uY=ev.getY();
    }

    public void mouseExited(MouseEvent event) {}
    public void mouseReleased(MouseEvent event) {}
    public void mouseClicked(MouseEvent event) {}
    public void mouseEntered(MouseEvent event) {}
 //interface MouseMotionListener
    public void mouseDragged(MouseEvent ev) {
        int x = ev.getX();
        int y = ev.getY();
        Graphics g=getGraphics();
        g.drawLine(uX, uY, x, y);
        uX=x;   uY=y;
        g.dispose();
    }
    public void mouseMoved(MouseEvent event) {}

}

